﻿/*-------------------------------------
//
//Copyright (C) 2007 开发二组 版权所有。
//
//文件名：SendGoods.cs
//
//
//文件功能描述：显示热卖商品列表.
//
//
//创建标识：2007.11.19王志平
//创建描述：热卖商品描述..
//
//------------------------------------*/
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


public partial class SendGoods : System.Web.UI.UserControl
{
    localhost.ProductService myOperate = new localhost.ProductService();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindHotProduct();
        }
    }

    protected void BindHotProduct()
    {
       
        myOperate.GetProductListByProductTypeTop8Completed += new localhost.GetProductListByProductTypeTop8CompletedEventHandler(myOperate_GetProductListByProductTypeTop8Completed);

        myOperate.GetProductListByProductTypeTop8Async("HotProduct");
    }

    void myOperate_GetProductListByProductTypeTop8Completed(object sender, localhost.GetProductListByProductTypeTop8CompletedEventArgs e)
    {

        try
        {
            DataSet dsHotProduct = new DataSet();

            dsHotProduct = e.Result;

            dlstPopProducts.DataSource = dsHotProduct;

            dlstPopProducts.DataBind();
        }
        catch (Exception ex)
        {
            Response.Redirect("Msg.aspx?msg=" + ex.Message);
        }

    }

    /// <summary>
    /// 查看热卖商品的详细信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dlstPopProducts_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        //获取商品ID
        string strProductID = ((Label)e.Item.FindControl("lblProductID")).Text;

        ((HyperLink)e.Item.FindControl("lnkHotProduct")).NavigateUrl = "../ProductInfo.aspx?productID=" + strProductID;

    }
}
